const AuthStepType = {
  ONE: 1,
  TWO: 2,
  THREE: 3,
};

Component({
  options: {
    multipleSlots: true,
  },
  properties: {
    currAuthStep: {
      type: Number,
      value: AuthStepType.ONE,
    },
    userInfo: {
      type: Object,
      value: {},
      observer: function(){
        // this.setData({
        //   userInfo: this.properties.userInfo
        // }, ()=>{
        //   console.log('用户组件userInfo数据监听触发', this.properties.userInfo)
        // })
      }
    },
    isNeedGetUserInfo: {
      type: Boolean,
      value: false,
    },
  },
  data: {
    defaultAvatarUrl:
      'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png',
    AuthStepType,
  },
  methods: {
    gotoUserEditPage() {
      this.triggerEvent('gotoUserEditPage');
    },
    previewAvatar(){
      console.log('预览头像')
      const pages = getCurrentPages();
      const currentPage = pages[pages.length - 1];
      var avatar = currentPage.data.loginData.userInfo.avatarUrl;
      wx.previewImage({
        // 当前显示图片的链接
        current: avatar,
        // 需要预览的图片链接列表
        urls: [avatar]
      });
    },
    onHandleLogin(e){
      const detail = e.detail;
      console.log('phoneOneClickLogin errCode', detail.errCode)
    }
  },
});
